//
//  HMSportMapModeVC.m
//  BlackHorseLine
//
//  Created by made on 17/3/10.
//  Copyright © 2017年 made. All rights reserved.
//

#import "HMSportMapModeVC.h"

@interface HMSportMapModeVC ()

//记录当前点击按钮
@property(nonatomic, strong)UIButton *clickButton;

@end

@implementation HMSportMapModeVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //设置当前地图类型按钮为选中状态
    UIButton *btn = [self.view viewWithTag:self.mapType+1];
    btn.selected = YES;
    self.clickButton = btn;
}




- (IBAction)mapModeButtonClick:(UIButton *)sender {
    //0判断是否重复点击按钮,如果是则不做任何处理,可以提高性能
    if (sender == self.clickButton) {
        return;
    }
    //1.取消上一次按钮的选中状态
    self.clickButton.selected = NO;
    //2.设置本次按钮的选中状态
    sender.selected = YES;
    //3.设置本次按钮作为当前点击按钮
    self.clickButton = sender;
    
    if (self.modeButtonClickBlock) {
        self.modeButtonClickBlock(sender.tag);
    }
}








- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
